Install using Node.js Version Manager (NVM)
1. Install & Update script
To install or update nvm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL or Wget command:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bashor
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bashRunning either of the above commands downloads a script and runs it.
2. Verify installation
To verify that nvm has been installed, do:
$ command -v nvmwhich should output nvm if the installation was successful. After running the install script, if you get nvm: command not found or see no feedback from your terminal after you type command -v nvm, simply logout of your terminal, then log back in and try verifying again.
3. Install the latest release of node
To download, compile, and install the latest release of node, do this:
$ nvm install nodeAs of this writing, 10/30/2019, the latest version is 13.0.1
The first version installed becomes the default. New shells (each time you logout/log back in) will start with the default version of node.
You can list available versions using ls-remote:
$ nvm ls-remoteTo install a specific version of node: as of this writing, 10/30/2019, the latest LTS is 12.13.0
$ nvm install 12.13.0You can tell nvm to use the version you just downloaded by typing:
$ nvm use 12.13.0To see the version of node currently being used:
$ node -vREFERENCES
https://github.com/nvm-sh/nvm
https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04
